#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, q;
    cin >> n >> q;
    for(int i = 1; i < n; i++) {
        cout << i << ' ' << i + 1 << endl;
    }
    int t = 2;
    while(q--) {
        int x;
        cin >> x;
        int p = n - x + 1;
        if(p == t) {
            cout << "-1 -1 -1\n";
        }else{
            cout << 1 << ' ' << t << ' ' << p << endl;
            t = p;
        }
    }

}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}